import DlgDraggable from "vue-element-dialog-draggable"

import utils from "./utils";
import {$m} from './utils'
import components from "./components";

import preferences from "./config/preferences";
import { style, px2 } from "./style/Style.js";
let mixinTimer

export default {
  install: function (Vue,options) {
    // style
    Vue.prototype.style = style;
    Vue.prototype.px2 = px2;
    // Preferences
    Vue.prototype.preferences = preferences;

    Vue.use(utils)
    Vue.use(components)

    Vue.use(DlgDraggable, {
      // containment: true //Constrains dragging to within the bounds of the window.  Default: false.
    });

    var mixin = {
      deactivated(){
        clearTimeout(mixinTimer)
        mixinTimer = setTimeout(()=>{
          let list = document.getElementsByClassName("el-tooltip__popper");
          if (list.length > 0) {
            list[list.length - 1].style.display = "none";
          }
        },0)
      },
    }
    Vue.mixin(mixin)
  }
}


export {
  px2,
  style,
  $m,
  preferences
}
